package cn.wolfcode.p2p.business.service;

import java.math.BigDecimal;
import java.util.Date;

import com.github.pagehelper.PageInfo;

import cn.wolfcode.p2p.business.domain.BidRequest;
import cn.wolfcode.p2p.business.domain.PaymentSchedule;
import cn.wolfcode.p2p.business.query.BidRequestQueryObject;
import cn.wolfcode.p2p.business.query.PaymentScheduleQueryObject;

/**
 * 借款服务
 * 
 * @author wolfcode
 *
 */
public interface IBidRequestService {

	BidRequest get(Long id);

	/**
	 * 修改借款对象(注意乐观锁问题)
	 * 
	 * @param br
	 */
	void update(BidRequest br);

	/**
	 * 申请借款
	 * 
	 * @param to
	 */
	void apply(BidRequest to);

	/**
	 * 列表查询
	 */
	PageInfo<BidRequest> query(BidRequestQueryObject qo);

	/**
	 * 发表前审核
	 * 
	 * @param id
	 * @param state
	 * @param remark
	 */
	void publishAudit(Long id, int state, String remark, Date publishTime);

	/**
	 * 投标
	 * 
	 * @param bidRequestId
	 * @param amount
	 */
	void bid(Long bidRequestId, BigDecimal amount);

	/**
	 * 风控终审
	 * 
	 * @param id
	 * @param state
	 * @param remark
	 */
	void fullAudit1(Long id, int state, String remark);

	/**
	 * 财务终审
	 * 
	 * @param id
	 * @param state
	 * @param remark
	 */
	void fullAudit2(Long id, int state, String remark);

	/**
	 * 还款计划列表
	 */
	PageInfo<PaymentSchedule> queryPaymentSchedules(PaymentScheduleQueryObject qo);

	/**
	 * 还款
	 * 
	 * @param id
	 */
	void returnMoney(Long id);

	/**
	 * 处理定时发标检查
	 */
	void publishInTime();

}
